package com.marvels.approve.credit.service;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.springframework.web.multipart.MultipartFile;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageInfo;
import com.marvels.approve.credit.dto.CreditExcelDTO;
import com.marvels.approve.credit.dto.EdcBurialPointMsgDTO;
import com.marvels.approve.credit.dto.McamAttachmentInfoDTO;
import com.marvels.approve.loan.dto.McamLoanApplyInfoDTO;
import com.marvels.approve.process.dto.HandleProcessDTO;
import com.marvels.approve.process.dto.LaAttachAtmeTypeViewDTO;
import com.marvels.approve.process.dto.LoanApplyCaseDTO;
import com.marvels.approve.process.dto.ScreenshotsDTO;
import com.marvels.common.exception.MarvelsBusinessException;

/**
 * 征信报告service
 * 
 * @author 宁华勇
 *
 */
public interface CreditReportService {
	/**
	 * 查询当前进件用户的影像资料
	 * 
	 * @param loanId
	 * @return
	 * @throws MarvelsBusinessException
	 */
	public List<McamAttachmentInfoDTO> getUserMediaByLoanId(String loanId) throws MarvelsBusinessException;

	/**
	 * 根据条件查询进件列表
	 * 
	 * @param param
	 * @return
	 * @throws MarvelsBusinessException
	 */
	public PageInfo<LoanApplyCaseDTO> getPageInfoByCondition(LoanApplyCaseDTO param) throws MarvelsBusinessException;

	/**
	 * 查询当前进件用户的基本信息
	 * 
	 * @param loanId
	 * @return
	 */
	public LoanApplyCaseDTO getUserBaseInfoByLoanId(String loanId) throws MarvelsBusinessException;
	
	/**
	 * 查询当前节点的进件用户的基本信息
	 * @param loanId
	 * @param nodeCode
	 * @return
	 * @throws MarvelsBusinessException
	 */
	public LoanApplyCaseDTO getUserBaseInfoByNodeCode(String loanId,String nodeCode) throws MarvelsBusinessException;
	
	public Map<String, Object> getUserCreditInfo(String loanId) throws MarvelsBusinessException;

	/**
	 * 提交到下一流程节点
	 * (woCreditInspection->woCreditLoadUp,woCreditLoadUp->woCreditCheck,
	 * woCreditCheck->woChecking)
	 * 
	 * @param caseInfo
	 * @throws MarvelsBusinessException
	 */
	public LoanApplyCaseDTO commitToNextNode(LoanApplyCaseDTO caseInfo) throws MarvelsBusinessException;

	/**
	 * 征信否决
	 * 
	 * @param param
	 */
	public void vetoCase(LoanApplyCaseDTO param) throws MarvelsBusinessException;

	/**
	 * 征信阶段退回
	 * @param param:申请信息
	 * @param caseNode
	 * @param loanStatus
	 * @throws MarvelsBusinessException
	 */
	public void chargeBack(McamLoanApplyInfoDTO param,String caseNode,String loanStatus) throws MarvelsBusinessException;

	/**
	 * 征信报告上传
	 * 
	 * @param uploadStream
	 * @param loanId
	 */
	public void creditReportUpload(InputStream uploadStream, String loanId) throws MarvelsBusinessException;

	/**
	 * 查询待取件数量
	 * 
	 * @param param
	 * @return
	 */
	public Integer getWaitForDealCount(LoanApplyCaseDTO param);

	/**
	 * 查询已审核完成列表
	 * 
	 * @param param
	 * @return
	 */
	public PageInfo<LoanApplyCaseDTO> getApproveFinishList(LoanApplyCaseDTO param) throws MarvelsBusinessException;


	/**
	 * 下载zip包
	 * 
	 * @param loanId
	 * @param request
	 * @param response
	 * @throws MarvelsBusinessException
	 */
	public void downLoadMedia(String loanId, HttpServletRequest request, HttpServletResponse response)
			throws MarvelsBusinessException;

	
	/**
	 * 下载征信excel
	 * @param param
	 * @return 
	 * @throws IOException 
	 */
	public HSSFWorkbook downloadCreditExcel(CreditExcelDTO param,HttpServletRequest request, HttpServletResponse response) throws MarvelsBusinessException, IOException;
	
	
	public Integer submitCirculation(LoanApplyCaseDTO param) throws MarvelsBusinessException;
	/**
	 * 征信前置核录列表查询
	 * @param param
	 * @return
	 * @throws MarvelsBusinessException
	 */
	public Map<String,Object> creReportBeforeList(LoanApplyCaseDTO param) throws MarvelsBusinessException;
	/**
	 * 征信前置上传附件
	 * @param file
	 * @param loanId
	 * @param atmtTypeName
	 * @param AtmtType
	 * @return
	 * @throws MarvelsBusinessException
	 * @throws IOException 
	 */
	public Integer uploadFile(MultipartFile file,String loanId,String atmtTypeName,String AtmtType) throws MarvelsBusinessException, IOException;

	/**
	 * 保单截屏数据
	 * @param screenshotsDTO
	 * @return
	 * @throws MarvelsBusinessException
	 */
	public PageInfo<ScreenshotsDTO> getScreenshotsList(ScreenshotsDTO screenshotsDTO) throws MarvelsBusinessException;
	/**
	 * 保单退单到前端 
	 * @param screenshotsDTO
	 * @return
	 * @throws MarvelsBusinessException
	 */
	public Integer  refusedDate(ScreenshotsDTO screenshotsDTO) throws MarvelsBusinessException;
	/**
	 * 保单截屏中保存功能，只检查有没有截屏数据，
	 * 没有数据则提示
	 * @param param
	 * @return
	 */
	public Integer submitDate(ScreenshotsDTO screenshotsDTO) throws MarvelsBusinessException;
	/**
	 * 保单截屏后数据存入新系统
	 */
	public Integer savaScreenshotsData(ScreenshotsDTO screenshotsDTO) throws MarvelsBusinessException;
	
	/**
	 * 获取当前支持的所有类型的附件信息
	 * @param screenshotsDTO
	 * @return
	 * @throws MarvelsBusinessException
	 */
	public List<LaAttachAtmeTypeViewDTO> getAttachmentsByViewKey(String loanId) throws MarvelsBusinessException;
	
	/**取件，征信4阶段
	 * @param handleProcessDTO
	 * @return
	 * @throws MarvelsBusinessException
	 */
	public LoanApplyCaseDTO handleProcess(HandleProcessDTO handleProcessDTO) throws MarvelsBusinessException;
	/**
	 * 签名附件覆盖原签名影像文件
	 * @param screenshotsDTO
	 * @return
	 * @throws MarvelsBusinessException
	 */
	public Integer updateImageInfo(ScreenshotsDTO screenshotsDTO)throws MarvelsBusinessException;
	
	/**条件查询流程信息
	 * @param loanApplyCaseDTO
	 * @return
	 */
	public List<com.marvels.approve.process.dto.LoanApplyCaseDTO> findCreditList(LoanApplyCaseDTO loanApplyCaseDTO)throws MarvelsBusinessException;
	
	/**
	 * 查看合同
	 * @param loandId
	 * @return
	 */
	public List<McamAttachmentInfoDTO> queryContract(String loandId)throws MarvelsBusinessException;
	
	
	/**
	 * 获取短信记录
	 * @param edcBurialPointMsgDTO
	 * @return
	 */
	public Page<EdcBurialPointMsgDTO> getBurialPointMsg(EdcBurialPointMsgDTO edcBurialPointMsgDTO) throws MarvelsBusinessException;
	
}
